package com.group10.controller;

import com.group10.entity.Result;
import com.group10.service.impl.LikeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/like")
public class LIkeController {

    @Autowired
    private LikeServiceImpl likeService;

    @PostMapping("/insertLike")
    public Result<?> insertLike(@RequestHeader(name = "Authorization") String token,String topic, Integer likeId){
        System.out.println(likeId + "---------------");
        return likeService.insertLike(token,topic,likeId);
    }

    @GetMapping("/isLike")
    public Result<?> isLike(@RequestHeader(name = "Authorization") String token,String topic,Integer likeId){
        return likeService.isLike(token,topic,likeId);
    }

    @GetMapping("/getCount")
    public Result<?> getCount(String topic, Integer likeId){
        return likeService.getCount(topic,likeId);
    }

    @PutMapping("/deleteLike")
    public Result<?> deleteLike(@RequestHeader(name = "Authorization") String token,String topic, Integer likeId){
        return likeService.deleteLike(token,topic,likeId);
    }
}